#define _CRT_SECURE_NO_WARNINGS 1
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
const int N = 110;
ll a[N];

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ll n; cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum += a[i];
	}
	ll ave = sum / n;
	ll cnt = 0;
	for (int i = 1; i <= n; i++) {
		if (a[i] - ave) {
			a[i + 1] += a[i] - ave;
			cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}